$('#logout').on('click', function () {
    //确认
    var isComfirm = confirm('确定要退出吗？')
    if (isComfirm) {
        $.ajax({
            type: 'post',
            url: '/logout',
            success (res) {
                location.href = 'login.html'
            }
        })
    }

})

$.ajax({
    type : 'get',
    url: `/users/${userId}`,
    success (res) {
        $('.profile .name').text(res.nickName);
        $('.profile img.avatar').attr('src', res.avatar);
    }
})